home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / scramble.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  2KB  |  105 lines

  1. /***************************************************************************
  2.  
  3.   machine.c
  4.  
  5.   Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
  6.   I/O ports)
  7.  
  8. ***************************************************************************/
  9.  
  10. #include "driver.h"
  11.  
  12.  
  13. READ_HANDLER( scramble_input_port_2_r )
  14. {
  15.     int res;
  16.  
  17.  
  18.     res = readinputport(2);
  19.  
  20. /*logerror("%04x: read IN2\n",cpu_get_pc());*/
  21.  
  22.     /* avoid protection */
  23.     if (cpu_get_pc() == 0x00e4) res &= 0x7f;
  24.  
  25.     return res;
  26. }
  27.  
  28.  
  29.  
  30. READ_HANDLER( scramble_protection_r )
  31. {
  32.     logerror("%04x: read protection\n",cpu_get_pc());
  33.  
  34.     return 0x6f;
  35. }
  36.  
  37. READ_HANDLER( scramblk_protection_r )
  38. {
  39.     switch (cpu_get_pc())
  40.     {
  41.     case 0x00a8: return 0xf0;
  42.     case 0x00be: return 0xb0;
  43.     case 0x0c1d: return 0xf0;
  44.     case 0x0c6a: return 0xb0;
  45.     case 0x0ceb: return 0x40;
  46.     case 0x0d37: return 0x60;
  47.     case 0x1ca2: return 0x00;  /* I don't think it's checked */
  48.     case 0x1d7e: return 0xb0;
  49.     default:
  50.         logerror("%04x: read protection\n",cpu_get_pc());
  51.         return 0;
  52.     }
  53. }
  54.  
  55. READ_HANDLER( scramblb_protection_1_r )
  56. {
  57.     switch (cpu_get_pc())
  58.     {
  59.     case 0x01da: return 0x80;
  60.     case 0x01e4: return 0x00;
  61.     default:
  62.         logerror("%04x: read protection 1\n",cpu_get_pc());
  63.         return 0;
  64.     }
  65. }
  66.  
  67. READ_HANDLER( scramblb_protection_2_r )
  68. {
  69.     switch (cpu_get_pc())
  70.     {
  71.     case 0x01ca: return 0x90;
  72.     default:
  73.         logerror("%04x: read protection 2\n",cpu_get_pc());
  74.         return 0;
  75.     }
  76. }
  77.  
  78.  
  79. READ_HANDLER( mariner_protection_1_r )
  80. {
  81.     return 7;
  82. }
  83. READ_HANDLER( mariner_protection_2_r )
  84. {
  85.     return 3;
  86. }
  87.  
  88.  
  89. READ_HANDLER( mariner_pip_r )
  90. {
  91.     logerror("PC %04x: read port 2\n",cpu_get_pc());
  92.     if (cpu_get_pc() == 0x015a) return 0xff;
  93.     else if (cpu_get_pc() == 0x0886) return 0x05;
  94.     else return 0;
  95. }
  96.  
  97. READ_HANDLER( mariner_pap_r )
  98. {
  99.     logerror("PC %04x: read port 3\n",cpu_get_pc());
  100.     if (cpu_get_pc() == 0x015d) return 0x04;
  101.     else return 0;
  102. }
  103.  
  104.  
  105.